package com.ruoyi.web.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.domain.OrderRecord;
import com.ruoyi.web.domain.Product;
import com.ruoyi.web.service.IOrderRecordService;
import com.ruoyi.web.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 订单Controller
 * 
 * @author song
 * @date 2024-05-11
 */
@RestController
@RequestMapping("/admin/order")

public class OrderRecordController extends BaseController
{
    @Autowired
    private IOrderRecordService orderRecordService;

    /**
     * 查询订单列表
     */

    @GetMapping("/list")
    public TableDataInfo list(Product product)
    {
        startPage();
        List<OrderRecord> list = orderRecordService.selectOrderRecordList(product);

        return getDataTable(list);
    }



    /**
     * 获取订单详细信息
     */
    @GetMapping(value = "/{productNo}")
    public AjaxResult getInfo(@PathVariable("productNo") String productNo)
    {
        return success(orderRecordService.selectProductByNo(productNo));
    }
    /**
     * 获取订单详细信息
     */
    @GetMapping(value = "search/{productNo}")
    public AjaxResult search(@PathVariable("productNo") String productNo)
    {
        return success(orderRecordService.selectProductByNo(productNo));
    }


}
